<?php slot('contents') ?>
  <?php if($productPictures->count() > 1): ?>
    <script type="text/javascript" src="/web/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" href="/web/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
    <script type="text/javascript">
      $(document).ready(function() {
        $('.fancy-pictures').fancybox({
    			'transitionIn'		: 'fade',
    			'transitionOut'		: 'fade',
    			'titlePosition' 	: 'over',
    			'overlayColor'		: '#000',
    			'showCloseButton' : 'true',
    			'showNavArrows'   : 'true',
    			'overlayOpacity'	: 0.8,
    			'overlayShow'     : 'true',
          'hideOnOverlayClick' : 'true',
          'hideOnContentClick' : true
        });
          
        $('.product-tab').click(function() {
          location.href = $(this).children('a').attr('href');
        });
      });
    </script>
  <?php endif;?>
  <div class="breadcrumbs"><?php include_component('headerMenu', 'breadCrumbs') ?></div>
  <table cellpadding="0" cellspacing="0" style="width: 600px">
      <tr>
        <td class="first" align="left" valign="middle"><h1><?php echo $product->getName() ?></h1></td>
        <td class="second" align="right" valign="middle"><a href="<?php echo LinkGen::getInstance(LinkGen::PRODUCT)->link($product->getId()) ?>/productPage/print" target="_blank"><img src="/web/img/print.png" alt="Print" /></a>  <div style="float: right;" class="addthis_toolbox addthis_default_style ">
<a href="http://www.addthis.com/bookmark.php?v=250&amp;pubid=xa-4d7fd30b003a4ca5" class="addthis_button_compact"><img src="/web/img/share.png" style="margin-left: 15px;" alt="Share" /></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4d7fd30b003a4ca5"></script></td>
      </tr>
      <tr>
        <td colspan="2">
          <!--// Product tabs -->
          <div class="product-tab-container">
            	<div class="product-tab-background">
                	<div class="product-tab<?php echo !$active ? ' product-is-active' : '' ?>">
                    	<a href="<?php echo LinkGen::getInstance(LinkGen::PRODUCT)->link($product->getId()) ?>" <?php echo !$active ? ' class="active"' : '' ?>><?php echo __('Info') ?></a>
                        <div class="arrow<?php echo !$active ? '-is-active' : '' ?>"></div>
                    </div>
                    <div class="product-tab">
                    	<a href="#"><?php echo __('Koosta lahendus') ?></a>
                        <div class="arrow"></div>
                    </div>
                    <?php if($tabs): ?>
                      <?php foreach($tabs as $tab): ?>
                        <div class="product-tab<?php echo ($tab->getParameter()->getId() == $active) ? ' product-is-active' : ''; ?>">
                      	<a href="<?php echo LinkGen::getInstance(LinkGen::PRODUCT)->link($product->getId()) ?>?id=<?php echo $tab->getParameter()->getId() ?>" <?php echo ($tab->getParameter()->getId() == $active) ? ' class="active"' : ''; ?>><?php echo $tab->getParameter()->getName() ?></a>
                          <div class="arrow<?php echo ($tab->getParameter()->getId() == $active) ? '-is-active' : ''; ?>"></div>
                        </div>
                      <?php endforeach; ?>
                    <?php endif; ?>
                    <div class="product-tab-end"></div>
                </div>
          </div>
          <!--// Zoom button -->
          <div class="zoom-container">
          	<a href="" id="zoom"><img src="/web/img/zoom.png" alt="Enlarge image" /></a>
          </div>
          </td>
      </tr>
      <tr>
        <td colspan="2">
        	<div>
            	<div class="p-container">
                	<div class="p-contents-container">
                    	<p>
                        <?php if(isset($value) && $value): ?>
                          <?php if($value->getParameter()->getType() == 'PICTURE'): ?>
                            <img src="/web/uploads<?php echo $value->getValue() ?>" alt="" />
                          <?php else: ?>
                            <p><?php echo $value->getValue() ?></p>
                          <?php endif; ?>
                        <?php else: ?>
                          <?php if($product->getDescription()): ?>
                            <?php echo nl2br($product->getDescription()); ?>
                          <?php else: ?>
                            <?php echo __('No description is available') ?>
                          <?php endif; ?>
                        <?php endif; ?>
                      </p>
                    </div>
                    <div class="p-left-line"></div>
                    <div class="p-right-line"></div>
                </div>
                <div class="p-picture">
                  <?php if($productPictures->count() > 1): ?>
                    <?php if($productPictures->count() >= 2):  // Slideshow is available ?>
                      <?php $pic = $productPictures->toArray() ?>
                      <a href="#open" class="fancy-pictures" rel="fancy-pictures" id="open"><img src="/web/uploads<?php echo $pic[1]['file'] ?>" alt="" /></a>
                    <?php else:  // No, we have only the first picture ?>
                      <img src="/web/uploads<?php echo $productPictures->getFirst()->getFile() ?>" />
                    <?php endif; ?>
                  <?php else: ?>
                    <img src="/web/uploads<?php echo $product->getBrandPicture() ?>" />
                  <?php endif; ?>
                </div>
            </div>
           <div class="term"></div>
        </td>
      </tr>
      <?php if($product->video_link): ?>
        <tr>
          <td colspan="2" style="padding-top: 20px;" align="center">
            <div style="margin: 0 20px 20px 0; text-align: center;"><iframe title="YouTube video player" width="426" height="240" src="<?php echo $product->video_link ?>" frameborder="0" allowfullscreen></iframe></div>
          </td>
        </tr>
      <?php endif; ?>
    </table>
    <div style="display: none">
      <?php foreach($productPictures as $j => $picture): ?>
        <?php if($j <= 1) continue ?>
        <a class="fancy-pictures" rel="fancy-pictures" href="/web/uploads<?php echo $picture->getFile() ?>"></a> 
      <?php endforeach; ?>
    </div>
<?php end_slot() ?>